Detection of oxygen by Lassaigne test
Sodium-Fusion test or Lassaigne test was originally introduced by Lassaigne in 1843 (Ref.1), and was subsequent modified by Jacobsen in 1879 (Ref.2). The major modification of Jacobson was the replacement of potassium by sodium metal as the active reagent. Since then, the test has altered very little, and basically is still in use today. The difficulties associated with the test have been reviewed in 1969 (Ref.3).
The sodium-Fusion test or Lassaigne test is a general test for the detection of halogens, nitrogen, and sulfur in an organic compound. These elements are usually covalently bonded to the organic compounds such as halo, nitro, amino, and thio compounds. In order to identify their presence, each covalently bonded element has to be converted into their ionic forms. This task is achieved by fusing the organic compound with melting sodium metal. The ionic compounds formed during the fusion are then extracted into aqueous solution and subsequently identified by simple chemical tests. The aqueous extract is called sodium fusion extract or Lassaigne's extract.
The reference 3 gives good procedural practice for preparation of Lassaigne's extract, thus I'm not going to elaborate too much unless it is necessary and going to address the question directly: Test for nitrogen usually involves boiling an alkaline sample of
the water-extract from the sodium fusion with ferrous sulfate and then cooling and acidifying with dilute sulfuric acid. The development of a blue coloration or a dark blue precipitate is confirmatory for nitrogen.
The theory: The carbon and nitrogen present in the organic compound on fusion with sodium metal gives sodium cyanide ($\ce{NaCN}$), which is soluble in water. This is converted into sodium ferrocyanide ($\ce{Na4Fe(CN)6}$) by the addition of sufficient quantity of ferrous sulphate ($\ce{FeSO4}$). Ferric ions ($\ce{Fe^3+}$) generated during the process react with ferrocyanide to form $\color{blue}{\text{prussian blue}}$ precipitate of ferric ferrocyanide ($\ce{Fe4[Fe(CN)6]3}$):
$$\ce{Na + C + N -&gt; NaCN }$$
$$\ce{6NaCN + FeSO4 -&gt; Na4Fe(CN)6 + Na2SO4}$$
$$\ce{3Na4Fe(CN)6 + 4Fe^3+ -&gt; Fe4[Fe(CN)6]3 + 12Na+}$$
There are two issues with this test, according to Ref.3:


It seems that the development of a blue coloration and/or precipitate in a positive test depends on pH and on temperature. With $\mathrm{pH}$ only just below 7, the development of coloration is inhibited. It is, thus, necessary to ensure the presence of an excess of acid. Similarly, cooling of the solution is advisable because development of the blue coloration appears to he inhibited in hot solutions.

During the Lassaigne's extract, if the compound has too much nitro groups and too little carbons, it is advisable that to add a little paraffin or a hydrocarbon before heating with sodium. Carbon in them provide enough carbon to make cyanide with nitrogen. In this praise, there is a answer for your question: Nitro group contains oxygen but did not interfere with the test.



References:

J. L. Lassaigne, &quot;Mémoire sur un procédé simple pour constater la présence de l'azote dans des quantités minimes de matière organique (Memoir on a simple procedure for confirming the presence of nitrogen in minimal quantities of organic matter),&quot; Comptes rendus 1843, 16, 387-391.
Oscar Jacobsen, &quot;Ueber die Oxydation der Parasulfamintoluylsäure (On the oxidation of 3-methyl-4-sulfamoyl-benzoic acid),&quot; Berichte der Deutschen Chemischen Gesellschaft 1879, 12, 2316-2320.
R. P. Gower, I. P. Rhodes, “A review of techniques in the Lassaigne sodium-fusion,” J. Chem. Educ. 1969, 46(9), 606-607 (https://doi.org/10.1021/ed046p606).