Beispiel #1
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     load_test_data(get_test_data())
     UserFactory.create(
         username='******',
         password='******')
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     load_test_data(get_test_data())
     UserFactory.create(
         username='******',
         password='******')
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     self.test_data = {
         'users': [
             {
                 'username': '******',
                 'password': '******',
                 'is_active': False,
             },
             {
                 'username': '******',
                 'password': '******',
                 'is_active': True,
             },
             {
                 'username': '******',
                 'password': '******',
                 'is_active': True,
                 '_is_superuser': True,
             }
         ]
     }
     (self.inactive_user, self.active_user,
      self.superuser) = self.test_data['users']
     load_test_data(self.test_data)
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Define 1 superuser and 9 other users
        users = []
        users.append({"username": "******", "password": "******", "_is_superuser": True})
        for uid in range(1, 10):
            users.append({"username": "******" + str(uid), "password": "******"})
        self.test_data = {"users": users}
        self.superuser = users[0]

        # Define 2 orgs and their members
        self.test_data["orgs"] = [
            {
                "name": "UNESCO",
                "description": ("United Nations Educational, Scientific, " + "and Cultural Organization"),
                "_members": (1, 2, 5, 6),
                "_admins": (1,),
            },
            {
                "name": "UNICEF",
                "description": "United Nations Children's Emergency Fund",
                "_members": (3, 4, 5, 6),
                "_admins": (3,),
            },
        ]

        load_test_data(self.test_data)
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     self.test_data = {
         'users': [{
             'username': '******',
             'password': '******',
         }]
     }
     load_test_data(self.test_data)
Beispiel #6
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     self.test_data = {
         'users': [{
             'username': '******',
             'password': '******',
         }, {
             'username': '******',
             'password': '******',
             '_is_superuser': True,
         }]
     }
     (self.user1, self.superuser) = self.test_data['users']
     load_test_data(self.test_data)
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Define 1 superuser and 9 other users
        users = []
        users.append({
            'username': '******',
            'password': '******',
            'full_name': 'Super User',
            'email': "*****@*****.**",
            'is_active': True,
            '_is_superuser': True,
        })
        for uid in range(1, 10):
            if uid < 5:
                last_login_val = (
                    datetime.now(tz=timezone.utc) -
                    timedelta(days=uid)
                )
            else:
                last_login_val = None
            users.append({
                'username': '******' + str(uid),
                'password': '******',
                'email': "default" + str(uid) + "@example.com",
                'last_login': last_login_val,
                'is_active': (uid % 2 == 1),
            })
        self.test_data = {
            'users': users,
        }
        self.superuser = users[0]

        # Define 2 orgs and their members
        self.test_data['orgs'] = [
            {
                'name': "Organization One",
                '_members': (1, 2, 3, 4),
            },
            {
                'name': "Organization Two",
                '_members': (3, 4, 5, 6),
            },
        ]

        load_test_data(self.test_data)
Beispiel #8
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     OrganizationRole.objects.create(
         organization=test_objs['organizations'][0],
         user=UserFactory.create(username='******',
                                 password='******'),
         admin=True)
Beispiel #9
0
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Define 1 superuser and 9 other users
        users = []
        users.append({
            'username': '******',
            'password': '******',
            'email': "*****@*****.**",
            'is_active': True,
            '_is_superuser': True,
        })
        for uid in range(1, 10):
            if uid < 5:
                last_login_val = (datetime.now(tz=timezone.utc) -
                                  timedelta(days=uid))
            else:
                last_login_val = None
            users.append({
                'username': '******' + str(uid),
                'password': '******',
                'email': "default" + str(uid) + "@example.com",
                'last_login': last_login_val,
                'is_active': (uid % 2 == 1),
            })
        self.test_data = {
            'users': users,
        }
        self.superuser = users[0]

        # Define 2 orgs and their members
        self.test_data['orgs'] = [
            {
                'name': "Organization One",
                '_members': (1, 2, 3, 4),
            },
            {
                'name': "Organization Two",
                '_members': (3, 4, 5, 6),
            },
        ]

        load_test_data(self.test_data)
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     OrganizationRole.objects.create(
             organization=test_objs['organizations'][0],
             user=UserFactory.create(
                     username='******',
                     password='******'),
             admin=True)
Beispiel #11
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     OrganizationRole.objects.create(
         organization=test_objs['organizations'][0],
         user=UserFactory.create(username='******',
                                 password='******'),
         admin=True)
     UserFactory.create(username='******',
                        email='*****@*****.**',
                        full_name="Han Solo",
                        password='******')
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Define 1 superuser and 9 other users
        users = []
        users.append({
            'username': '******',
            'password': '******',
            '_is_superuser': True,
        })
        for uid in range(1, 10):
            users.append({
                'username': '******' + str(uid),
                'password': '******',
            })
        self.test_data = {'users': users}
        self.superuser = users[0]

        # Define 2 orgs and their members
        self.test_data['orgs'] = [
            {
                'name':
                "UNESCO",
                'description': ("United Nations Educational, Scientific, " +
                                "and Cultural Organization"),
                '_members': (1, 2, 5, 6),
                '_admins': (1, ),
            },
            {
                'name': "UNICEF",
                'description': "United Nations Children's Emergency Fund",
                '_members': (3, 4, 5, 6),
                '_admins': (3, ),
            },
        ]

        load_test_data(self.test_data)
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     OrganizationRole.objects.create(
             organization=test_objs['organizations'][0],
             user=UserFactory.create(
                     username='******',
                     password='******'),
             admin=True)
     UserFactory.create(
         username='******',
         email='*****@*****.**',
         full_name="Han Solo",
         password='******')
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     self.org = test_objs['organizations'][0]
     self.prj = test_objs['projects'][1]
     OrganizationRole.objects.create(organization=self.org,
                                     user=UserFactory.create(
                                         username='******',
                                         password='******'),
                                     admin=True)
     ResourceFactory.create_batch(2,
                                  content_object=self.prj,
                                  project=self.prj)
     su = SpatialUnitFactory(geometry=GEOSGeometry(
         '{"type": "Polygon",'
         '"coordinates": [['
         '[-5.1031494140625000,'
         ' 8.1299292850467957], '
         '[-5.0482177734375000, '
         '7.6837733211111425], '
         '[-4.6746826171875000, '
         '7.8252894725496338], '
         '[-4.8641967773437491, '
         '8.2278005261522775], '
         '[-5.1031494140625000, '
         '8.1299292850467957]]]}'),
                             project=self.prj,
                             type='MI',
                             attributes={})
     ResourceFactory.create(content_object=su, project=self.prj)
     party = PartyFactory.create(project=test_objs['projects'][1])
     tenure = TenureRelationshipFactory.create(
         project=self.prj,
         party=party,
         spatial_unit=su,
         tenure_type=TenureRelationshipType.objects.create(
             id='CR', label='Customary Rights'))
     ResourceFactory.create(content_object=su, project=self.prj)
     ResourceFactory.create(content_object=party, project=self.prj)
     ResourceFactory.create(content_object=tenure, project=self.prj)
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     self.test_data = get_test_data()
     load_test_data(self.test_data)
Beispiel #16
0
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Define 1 OA
        self.test_data = {
            'users': [
                {
                    'username': '******',
                    'password': '******',
                }
            ]
        }
        self.orgadmin = self.test_data['users'][0]

        # Define 2 orgs the OA is an admin of
        self.test_data['orgs'] = [
            {
                'name': "UNESCO",
                'slug': 'unesco',
                'description': (
                    "United Nations Educational, Scientific, " +
                    "and Cultural Organization"
                ),
                'logo': (
                    'https://upload.wikimedia.org/wikipedia/commons/' +
                    'thumb/b/bc/UNESCO_logo.svg/320px-UNESCO_logo.svg.png'
                ),
                '_members': (0,),
                '_admins': (0,),
            },
            {
                'name': "UNICEF",
                'slug': 'unicef',
                'description': (
                    "United Nations Children's Emergency Fund"
                ),
                '_members': (),
                '_admins': (),
            },
        ]

        # Define 2 projects that will be duplicated in separate orgs
        self.test_data['projects'] = [
            {
                'name': "Project Gutenberg",
                'slug': 'project-gutenberg',
                'description': "Public project of UNESCO.",
                'country': 'PH',
                'access': 'public',
                '_org': 0,
                '_managers': (0,),
            },
            {
                'name': "Wikipedia",
                'slug': 'wikipedia',
                'description': "Public project of UNICEF.",
                'country': 'AU',
                'access': 'public',
                '_org': 1,
                '_managers': (),
            },
        ]

        load_test_data(self.test_data)
Beispiel #17
0
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Load world boundary data
        geography.load.run(verbose=False)

        # Define 1 SU, 1 OA, 1 org member, and 1 unaffiliated user
        self.test_data = {
            'superuser': {
                'username': '******',
                'password': '******',
                '_is_superuser': True,
            },
            'orgadmin': {
                'username': '******',
                'password': '******',
            },
            'orgmember': {
                'username': '******',
                'password': '******',
            },
            'unaffuser': {
                'username': '******',
                'password': '******',
            },
        }
        self.test_data['users'] = [{
            'username': '******',
            'password': '******',
            '_is_superuser': True,
        }, {
            'username': '******',
            'password': '******',
        }, {
            'username': '******',
            'password': '******',
        }, {
            'username': '******',
            'password': '******',
        }]
        (self.superuser, self.orgadmin, self.orgmember,
         self.unaffuser) = self.test_data['users']

        # Define 2 orgs the OA is an admin of and 1 other org
        self.test_data['orgs'] = [
            {
                'name':
                "UNESCO",
                'slug':
                'unesco',
                'description': ("United Nations Educational, Scientific, " +
                                "and Cultural Organization"),
                'logo':
                ('https://upload.wikimedia.org/wikipedia/commons/' +
                 'thumb/b/bc/UNESCO_logo.svg/320px-UNESCO_logo.svg.png'),
                '_members': (1, 2),
                '_admins': (1, ),
            },
            {
                'name': "UNICEF",
                'slug': 'unicef',
                'description': "United Nations Children's Emergency Fund",
                '_members': (1, ),
                '_admins': (1, ),
            },
            {
                'name':
                "UNOCHA",
                'slug':
                'unocha',
                'description':
                ("United Nations " +
                 "Office for the Coordination of Humanitarian Affairs"),
                '_members': [],
                '_admins': [],
            },
        ]

        # Search terms to specify a country
        self.test_data['countries'] = {
            'FR': "Paris, France",
            'RU': "Moscow, Russia",
            'AU': "Canberra, Australia",
            'DE': "Berlin, Germany",
        }

        self.test_data['project_slug'] = 'post-sokovia-land-tenure-project'
        self.test_data['project_name'] = "Post-Sokovia Land Tenure Project"
        self.test_data['project_description'] = (
            "This project aims to document land tenure in what is left of " +
            "Sokovia, which was destroyed during a conflict involving the " +
            "Avengers, a rogue vigilante group.")
        self.test_data['project_url'] = 'http://sokovia-accords.un.org/'

        load_test_data(self.test_data)
    def setUp(self):
        super().setUp()
        PolicyFactory.load_policies()

        # Load world boundary data
        geography.load.run(verbose=False)

        # Define 1 SU, 1 OA, 1 org member, and 1 unaffiliated user
        self.test_data = {
            "superuser": {"username": "******", "password": "******", "_is_superuser": True},
            "orgadmin": {"username": "******", "password": "******"},
            "orgmember": {"username": "******", "password": "******"},
            "unaffuser": {"username": "******", "password": "******"},
        }
        self.test_data["users"] = [
            {"username": "******", "password": "******", "_is_superuser": True},
            {"username": "******", "password": "******"},
            {"username": "******", "password": "******"},
            {"username": "******", "password": "******"},
        ]
        (self.superuser, self.orgadmin, self.orgmember, self.unaffuser) = self.test_data["users"]

        # Define 2 orgs the OA is an admin of and 1 other org
        self.test_data["orgs"] = [
            {
                "name": "UNESCO",
                "slug": "unesco",
                "description": ("United Nations Educational, Scientific, " + "and Cultural Organization"),
                "logo": (
                    "https://upload.wikimedia.org/wikipedia/commons/"
                    + "thumb/b/bc/UNESCO_logo.svg/320px-UNESCO_logo.svg.png"
                ),
                "_members": (1, 2),
                "_admins": (1,),
            },
            {
                "name": "UNICEF",
                "slug": "unicef",
                "description": "United Nations Children's Emergency Fund",
                "_members": (1,),
                "_admins": (1,),
            },
            {
                "name": "UNOCHA",
                "slug": "unocha",
                "description": ("United Nations " + "Office for the Coordination of Humanitarian Affairs"),
                "_members": [],
                "_admins": [],
            },
        ]

        # Search terms to specify a country
        self.test_data["countries"] = {
            "FR": "Paris, France",
            "RU": "Moscow, Russia",
            "AU": "Canberra, Australia",
            "DE": "Berlin, Germany",
        }

        self.test_data["project_slug"] = "post-sokovia-land-tenure-project"
        self.test_data["project_name"] = "Post-Sokovia Land Tenure Project"
        self.test_data["project_description"] = (
            "This project aims to document land tenure in what is left of "
            + "Sokovia, which was destroyed during a conflict involving the "
            + "Avengers, a rogue vigilante group."
        )
        self.test_data["project_url"] = "http://sokovia-accords.un.org/"

        load_test_data(self.test_data)
Beispiel #19
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     self.test_data = get_test_data()
     load_test_data(self.test_data)
Beispiel #20
0
 def setUp(self):
     super().setUp()
     PolicyFactory.load_policies()
     test_objs = load_test_data(get_test_data())
     self.org = test_objs['organizations'][0]
     self.prj = test_objs['projects'][0]