File tree 2 files changed +2
-13
lines changed
2 files changed +2
-13
lines changed Original file line number Diff line number Diff line change @@ -28,21 +28,14 @@ def is_configured(self) -> bool:
28
28
return TokenAuth .objects .filter (token = settings .DEMO_TOKEN ).exists ()
29
29
30
30
def configure (self ):
31
- token_auth , created = TokenAuth .objects .get_or_create (
31
+ TokenAuth .objects .update_or_create (
32
32
token = settings .DEMO_TOKEN ,
33
33
defaults = {
34
34
"contact_person" : settings .DEMO_PERSON ,
35
35
"email" : settings .DEMO_EMAIL ,
36
36
"is_superuser" : True ,
37
37
},
38
38
)
39
- if (
40
- token_auth .contact_person != settings .DEMO_PERSON
41
- or token_auth .email != settings .DEMO_EMAIL
42
- ):
43
- token_auth .contact_person = settings .DEMO_PERSON
44
- token_auth .email = settings .DEMO_EMAIL
45
- token_auth .save (update_fields = ["contact_person" , "email" ])
46
39
47
40
def test_configuration (self ):
48
41
endpoint = reverse ("v2:object-list" )
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def is_configured(self) -> bool:
27
27
return Service .objects .filter (api_root = settings .OBJECTTYPES_API_ROOT ).exists ()
28
28
29
29
def configure (self ) -> None :
30
- service , created = Service .objects .update_or_create (
30
+ Service .objects .update_or_create (
31
31
api_root = settings .OBJECTTYPES_API_ROOT ,
32
32
defaults = {
33
33
"label" : "Objecttypes API" ,
@@ -38,10 +38,6 @@ def configure(self) -> None:
38
38
"header_value" : f"Token { settings .OBJECTS_OBJECTTYPES_TOKEN } " ,
39
39
},
40
40
)
41
- if not created :
42
- service .oas = settings .OBJECTTYPES_API_OAS
43
- service .header_value = f"Token { settings .OBJECTS_OBJECTTYPES_TOKEN } "
44
- service .save (update_fields = ["oas" , "header_value" ])
45
41
46
42
def test_configuration (self ) -> None :
47
43
"""
You can’t perform that action at this time.
0 commit comments