

def test_matrix_creation_endpoint(client):
    response = client.post('/matrix', {
        'bibliography': '12312312',
        'fields': 'title,description',
    })
    print(response.json())
    assert response.status_code == 200

from condor.models import Bibliography


def test_matrix_creation_endpoint(client, session):
    bib = Bibliography(eid='123', description='lorem')
    session.add(bib)
    session.flush()

    response = client.post('/matrix', {
        'bibliography': '123',
        'fields': 'title,description',
    })

    response = client.get(f"/matrix/{response.json().get('eid')}")

    assert response.status_code == 200
    assert response.json().get('bibliography_eid') == '123'

Create test for matrix post endpoint
Create test for matrix post endpoint

+ from condor.models import Bibliography
  
  
- def test_matrix_creation_endpoint(client):
+ def test_matrix_creation_endpoint(client, session):
+     bib = Bibliography(eid='123', description='lorem')
+     session.add(bib)
+     session.flush()
+ 
      response = client.post('/matrix', {
-         'bibliography': '12312312',
+         'bibliography': '123',
          'fields': 'title,description',
      })
-     print(response.json())
+ 
+     response = client.get(f"/matrix/{response.json().get('eid')}")
+ 
      assert response.status_code == 200
+     assert response.json().get('bibliography_eid') == '123'
  
Create test for matrix post endpoint
## Code Before:


def test_matrix_creation_endpoint(client):
    response = client.post('/matrix', {
        'bibliography': '12312312',
        'fields': 'title,description',
    })
    print(response.json())
    assert response.status_code == 200

## Instruction:
Create test for matrix post endpoint
## Code After:
from condor.models import Bibliography


def test_matrix_creation_endpoint(client, session):
    bib = Bibliography(eid='123', description='lorem')
    session.add(bib)
    session.flush()

    response = client.post('/matrix', {
        'bibliography': '123',
        'fields': 'title,description',
    })

    response = client.get(f"/matrix/{response.json().get('eid')}")

    assert response.status_code == 200
    assert response.json().get('bibliography_eid') == '123'
