@@ -14,9 +14,18 @@ describe('DocumentUsage', function() {
14
14
let api : UserAPI ;
15
15
let session : gu . Session ;
16
16
17
- before ( async function ( ) {
18
- session = await gu . session ( ) . user ( ownerUser ) . login ( ) ;
17
+ gu . enableExternalAttachments ( ) ;
18
+
19
+ async function makeSessionAndLogin ( ) {
20
+ // login() needs an options object passing to bypass an optimization that causes .login()
21
+ // to think we're already logged in when we're not after using `server.restart()`.
22
+ // Without this we end up with bad credentials.
23
+ session = await gu . session ( ) . user ( ownerUser ) . login ( { retainExistingLogin : false } ) ;
19
24
api = session . createHomeApi ( ) ;
25
+ }
26
+
27
+ before ( async function ( ) {
28
+ await makeSessionAndLogin ( ) ;
20
29
} ) ;
21
30
22
31
it ( 'shows usage stats on the raw data page' , async function ( ) {
@@ -105,11 +114,15 @@ describe('DocumentUsage', function() {
105
114
} ) ;
106
115
} ) ;
107
116
108
- describe ( 'attachment usage' , function ( ) {
117
+ function testAttachments ( docSuffix : string ) {
109
118
let docId : string ;
110
119
111
120
before ( async ( ) => {
112
- docId = await session . tempNewDoc ( cleanup , "AttachmentUsageTestDoc" ) ;
121
+ docId = await session . tempNewDoc ( cleanup , `AttachmentUsageTestDoc - ${ docSuffix } ` ) ;
122
+ } ) ;
123
+
124
+ it ( 'updates attachments size usage when uploading attachments' , async function ( ) {
125
+ docId = await session . tempNewDoc ( cleanup , `AttachmentUsageTestDoc - ${ docSuffix } ` ) ;
113
126
} ) ;
114
127
115
128
it ( 'updates attachments size usage when uploading attachments' , async function ( ) {
@@ -147,6 +160,14 @@ describe('DocumentUsage', function() {
147
160
await assertDataSize ( '0.00' ) ;
148
161
await assertAttachmentsSize ( '0.00' ) ;
149
162
} ) ;
163
+ }
164
+
165
+ describe ( 'attachment usage without external attachments' , function ( ) {
166
+ testAttachments ( "without external attachments" ) ;
167
+ } ) ;
168
+
169
+ describe ( 'attachment usage with external attachments' , function ( ) {
170
+ testAttachments ( "with external attachments" ) ;
150
171
} ) ;
151
172
152
173
describe ( 'doc usage access' , function ( ) {
0 commit comments