WIP: mess
This commit is contained in:
parent
ca201eeb90
commit
ea85097cf8
3 changed files with 5 additions and 4 deletions
|
@ -7,7 +7,7 @@ from pydantic import BaseModel
|
|||
|
||||
|
||||
def get_default_config():
|
||||
return schema.Model().model_dump_json()
|
||||
return schema.Model(mastodon={}, peertube={},pixelfed={}).model_dump_json()
|
||||
|
||||
|
||||
class Configuration(models.Model):
|
||||
|
|
|
@ -21,7 +21,7 @@ class ConfigurationForm(TestCase):
|
|||
)
|
||||
|
||||
self.client.login(username=self.username, password=self.password)
|
||||
response = self.client.get(self.config_url)
|
||||
response = self.client.get(self.config_url, follow=True)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
context = response.context[0]
|
||||
|
@ -35,9 +35,9 @@ class ConfigurationForm(TestCase):
|
|||
"mastodon.enable": True,
|
||||
}
|
||||
print(form_data)
|
||||
response = self.client.post(self.config_url, data=form_data)
|
||||
response = self.client.post(self.config_url, data=form_data, follow=True)
|
||||
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
config.refresh_from_db()
|
||||
|
||||
print(config.parsed_value)
|
||||
|
|
|
@ -48,6 +48,7 @@ class ConfigurationForm(LoginRequiredMixin, APIView):
|
|||
return obj
|
||||
|
||||
def get(self, request):
|
||||
|
||||
config = self.get_object()
|
||||
serializer = schema.Model.drf_serializer(instance=config.parsed_value)
|
||||
return Response({
|
||||
|
|
Loading…
Add table
Reference in a new issue