def setUp(self):
     project_id = create.create_refine_project(TEST_DATA, 'Test project (can be safely removed).')
     # We need to reopen the project in order to force the refresh after
     # applying the JSON operations.
     server = refine.Refine(create.SERVER)
     self.project = server.open_project(project_id)
     self.affs = export.format_affiliations(project_id)
    def setUp(self):
        project_id = create.create_refine_project(
            TEST_DATA, 'Test project (can be safely removed).')
        # We need to reopen the project in order to force the refresh after
        # applying the JSON operations.
        server = refine.Refine(create.SERVER)
        self.project = server.open_project(project_id)

        # Perform a few edits.
        ## Modify an affiliation.
        self.project.edit(
            'New affiliation',
            'Astronomical Institute "Anton Pannekoek", University of Amsterdam, Kruislaan 403, NL--1098 SJ Amsterdam, The Netherlands',
            'Astronomical Institute "Anton Pannekoek"')
        ## Remove an affiliation.
        self.project.edit('New affiliation', 'San Cosme y Damian, Paraguay',
                          '')
        ## Modify an email.
        self.project.edit('New emails', """[u'*****@*****.**"']""",
                          "[u'*****@*****.**']")
        ## Remove an email.
        self.project.edit('New emails', "[u'*****@*****.**']", '')
        self.project.edit('New emails', "[u'*****@*****.**']",
                          '[]')

        # Grab the affiliations.
        self.affs = export.format_affiliations(project_id)
    def setUp(self):
        project_id = create.create_refine_project(TEST_DATA, 'Test project (can be safely removed).')
        # We need to reopen the project in order to force the refresh after
        # applying the JSON operations.
        server = refine.Refine(create.SERVER)
        self.project = server.open_project(project_id)

        # Perform a few edits.
        ## Modify an affiliation.
        self.project.edit('New affiliation', 'Astronomical Institute "Anton Pannekoek", University of Amsterdam, Kruislaan 403, NL--1098 SJ Amsterdam, The Netherlands', 'Astronomical Institute "Anton Pannekoek"')
        ## Remove an affiliation.
        self.project.edit('New affiliation', 'San Cosme y Damian, Paraguay', '')
        ## Modify an email.
        self.project.edit('New emails', "[u'[email protected]\"']", '["*****@*****.**"]')
        ## Remove an email.
        self.project.edit('New emails', "[u'*****@*****.**']", '')
        self.project.edit('New emails', "[u'*****@*****.**']", '[]')

        # Grab the affiliations.
        self.affs = export.format_affiliations(project_id, modified_only=True)

        # Test if the edits went OK.
        self.assertEqual(self.get_cell(1, 'New affiliation'), 'Astronomical Institute "Anton Pannekoek"')
        self.assertEqual(self.get_cell(14, 'New affiliation'), '')
        self.assertEqual(self.get_cell(4, 'New emails'), '["*****@*****.**"]')
        self.assertEqual(self.get_cell(16, 'New emails'), '')
        self.assertEqual(self.get_cell(10, 'New emails'), '[]')
 def setUp(self):
     project_id = create.create_refine_project(
         TEST_DATA, 'Test project (can be safely removed).')
     # We need to reopen the project in order to force the refresh after
     # applying the JSON operations.
     server = refine.Refine(create.SERVER)
     self.project = server.open_project(project_id)
     self.affs = export.format_affiliations(project_id)