Commit e9c8f9bcd2872899fa8b0fb78a96b8f4f533e1dd

Authored by Alexis Koralewski
1 parent 077d5a23
Exists in dev

fixing tests issues caused by new fields addition in SP table

src/core/pyros_django/common/tests.py
... ... @@ -23,8 +23,7 @@ class RequestBuilderTests(TestCase):
23 23 # (AKo) We need to assign UserLevel after PyrosUser creation, we can't associate directly from creation because it's a m2m relation
24 24 UserLevel.objects.all()[0].pyros_users.add(self.pyusr)
25 25 #self.sp = ScientificProgram.objects.create(name="default",institute=institute,sp_pi=self.pyusr,science_theme=ScienceTheme.objects.all().first())
26   - self.sp = ScientificProgram.objects.create(name="default",institute=institute,sp_pi=self.pyusr)
27   -
  26 + self.sp = ScientificProgram.objects.create(name="default",institute=institute,sp_pi=self.pyusr,science_theme=ScienceTheme.objects.all().first())
28 27 def test_full_creation(self):
29 28 '''
30 29 Goal : Create a full request with sequences, albums & plans, and check if they are in the DB
... ... @@ -103,7 +102,7 @@ class RequestTests(TestCase):
103 102 admin.pyros_users.add(haribo)
104 103 science_theme = ScienceTheme.objects.create(name="Solar System")
105 104 #sp1 = ScientificProgram.objects.create(name="sp1",institute=institute,sp_pi=haribo,science_theme=science_theme)
106   - sp1 = ScientificProgram.objects.create(name="sp1",institute=institute,sp_pi=haribo)
  105 + sp1 = ScientificProgram.objects.create(name="sp1",institute=institute,sp_pi=haribo,science_theme=ScienceTheme.objects.all().first())
107 106 req1 = Request.objects.create(
108 107 name="req1", pyros_user=haribo, scientific_program=sp1)
109 108 alert = Alert(strategyobs=strat1, request_id=req1)
... ...
src/core/pyros_django/misc/fixtures/tests/common_test.json
... ... @@ -155,6 +155,27 @@
155 155 }
156 156 },
157 157 {
  158 + "model":"common.ScienceTheme",
  159 + "pk":1,
  160 + "fields":{
  161 + "name":"Solar System"
  162 + }
  163 +},
  164 +{
  165 + "model":"common.ScienceTheme",
  166 + "pk":2,
  167 + "fields":{
  168 + "name":"Galatic"
  169 + }
  170 +},
  171 +{
  172 + "model":"common.ScienceTheme",
  173 + "pk":3,
  174 + "fields":{
  175 + "name":"Extra Galatic"
  176 + }
  177 +},
  178 +{
158 179 "model": "common.scientificprogram",
159 180 "pk": 1,
160 181 "fields": {
... ...
src/core/pyros_django/user_manager/tests.py
... ... @@ -30,10 +30,10 @@ class UserManagerTests(TestCase):
30 30 #sp2 = ScientificProgram.objects.create(name="sp2",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
31 31 #sp3 = ScientificProgram.objects.create(name="sp3",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
32 32 #sp4 = ScientificProgram.objects.create(name="sp4",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
33   - sp1 = ScientificProgram.objects.create(name="sp1",institute=institute,sp_pi=PyrosUser.objects.all().first())
34   - sp2 = ScientificProgram.objects.create(name="sp2",institute=institute,sp_pi=PyrosUser.objects.all().first())
35   - sp3 = ScientificProgram.objects.create(name="sp3",institute=institute,sp_pi=PyrosUser.objects.all().first())
36   - sp4 = ScientificProgram.objects.create(name="sp4",institute=institute,sp_pi=PyrosUser.objects.all().first())
  33 + sp1 = ScientificProgram.objects.create(name="sp1",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
  34 + sp2 = ScientificProgram.objects.create(name="sp2",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
  35 + sp3 = ScientificProgram.objects.create(name="sp3",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
  36 + sp4 = ScientificProgram.objects.create(name="sp4",institute=institute,sp_pi=PyrosUser.objects.all().first(),science_theme=science_theme)
37 37 SP_Period.objects.create(scientific_program=sp1,period=period)
38 38 SP_Period.objects.create(scientific_program=sp2,period=period)
39 39 SP_Period.objects.create(scientific_program=sp3,period=period)
... ...